package com.emapp.lccode.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.emapp.lccode.bean.MaterialKt
import com.emapp.lccode.databinding.ListitemMaterialBinding

class MaterialAdapter : BaseQuickAdapter<MaterialKt, MaterialAdapter.VH>() {

    class VH(
        parent: ViewGroup,
        val binding: ListitemMaterialBinding = ListitemMaterialBinding.inflate(
            LayoutInflater.from(parent.context), parent, false
        ),
    ) : RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
        return VH(parent)
    }

    override fun onBindViewHolder(holder: VH, position: Int, item: MaterialKt?) {
        holder.binding.tvName.text = item?.title + " (" + item?.fee + "元)"
        holder.binding.tvCode.text = "编码: " + item?.material_code
    }


}